<%--
  Created by IntelliJ IDEA.
  User: xiaoziyan
  Date: 2022/2/15
  Time: 22:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh-CN">

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>新增节点</title>

    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">

    <!-- 1. 导入CSS的全局样式 -->
    <link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="${pageContext.request.contextPath}/js/jquery-3.6.0.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript">

    </script>
    <style>
        .select_table {
            background-color: #F0F8FF;
            appearance:none;
            -moz-appearance:none;
            -webkit-appearance:none;
            -ms-appearance:none;
        }
    </style>
</head>
<body>
<div class="container" style="width: 400px; margin-top: 10%">
    <h3 style="text-align: center;margin-bottom: 15px;font-size: 24px;font-weight: bold">新增节点</h3>
    <form class="layui-form" action="addNodeServlet" method="post">
        <div class="form-group">
            <label>IMEI：</label>
            <input type="text" name="IMEI" class="form-control" lay-verify="required"  placeholder="请输入IMEI"/>
        </div>

        <div class="form-group">
            <label >节点地址：</label>
            <input type="text" name="node_location" class="form-control"  placeholder="请输入节点地址，没有可不填"/>
        </div>
        <div class="form-group">
            <label>所属项目：</label>
            <select name="project_id" class="form-control select_table"  >
                <c:forEach items="${project}" var="project">
                    <option <c:if test="${project.project_name=='岭南师范学院'}"> selected </c:if> value="${project.project_id}">${project.project_name}</option>
                </c:forEach>
            </select>
        </div>
        <div class="form-inline">
            <label for="vcode">验证码：</label>
            <input type="text" name="verifycode" class="form-control" id="verifycode" placeholder="请输入验证码" style="width: 120px;"/>
            <a style="margin-left: 10px">
                <img src="${pageContext.request.contextPath}/verifyCodeImg" title="看不清点击刷新" id="vcode" onclick=refreshCode() />
            </a>
        </div>
        <hr/>
        <div class="form-group" style="text-align: center;">
            <%--<a class="btn btn btn-primary" id="loginBt" >登录</a>--%>
            <input type="reset" class="btn btn btn-primary" value="重置信息" >
            <input type="submit" class="btn btn btn-primary" lay-submit="" value="新增节点" >

        </div>
    </form>

    <!-- 出错显示的信息框 -->
    <c:if test="${addError !=null}">
        <div class="alert alert-warning alert-dismissible" role="alert" id="login_error">
            <button type="button" class="close" data-dismiss="alert" >
                <span>&times;</span></button>
            <strong>${addError}</strong>
        </div>
    </c:if>



</div>
<script type="text/javascript">
    function refreshCode() {
        $("#vcode").prop("src", "${pageContext.request.contextPath}/verifyCodeImg?tm=" + new Date().getMilliseconds());//表示这个一个新的时间戳
    }

    layui.use(['layer'], function() {
        var layer = layui.layer
            , $ = layui.$;
        //弹出框
        <c:if test="${success !=null}">
        layer.open({
            type: 1
            , offset: 'auto' //垂直水平居中
            //,id: 'layerDemo'+type //防止重复弹出
            , content: '<div style="padding: 20px 100px;">' + '添加成功' + '</div>'
            , btn: '关闭'
            , btnAlign: 'c' //按钮居中
            , shade: 0 //不显示遮罩
            ,type:1
            ,time:2000
            , yes: function () {
                layer.closeAll();
            }
        });
        </c:if>
    });


</script>


</body>
</html>

